<?php
/**
 * This file is part of the Yacms (http://www.yacms.org)
 * Copyright (c) 2019 gylr0505 (http://www.yacms.org)
 *
 * Author: 鬼一浪人 <gylr0505@163.com>
 *
 * DateTime: 19-10-27 下午4:55
 * Description:
 */
 
declare(strict_types = 1);

namespace App\Template;

use Swlib\SaberGM;

class TemplateSender
{
    /**
     * @var ParamsBag
     */
    private $paramsBag;

    public function __construct(ParamsBag $paramsBag)
    {
        $this->paramsBag = $paramsBag;
    }

    /**
     * @return \Swlib\Saber\Request|\Swlib\Saber\Response
     * @throws \ReflectionException
     * @throws \Swoft\Bean\Exception\ContainerException
     * @throws \Swoft\Db\Exception\DbException
     */
    public function execute()
    {
        $url = $this->paramsBag->getUrl();
        $data = $this->paramsBag->generatorRequestParams();
        return SaberGM::post($url, $data);
    }
}